﻿Public Class CustomerCost
    Public numberOfDays As Integer
    Public numberOfGuests As Integer
    Public typeOfRoom As Integer
    Public checkInBefore As Boolean
    Public chekOutAfer As Boolean

    Public amountOfCharge As Double
    Public totalChargeForExGuest As Double
    Public totalAmountDiscount As Double
    Public Sub Clear()
        numberOfDays = 0
        numberOfGuests = 0
        typeOfRoom = -1
        checkInBefore = False
        chekOutAfer = False
        amountOfCharge = 0
        totalAmountDiscount = 0
        totalAmountDiscount = 0
    End Sub
    Public Sub New()
        numberOfDays = 0
        numberOfGuests = 0
        typeOfRoom = -1
        checkInBefore = False
        chekOutAfer = False
        amountOfCharge = 0
        totalAmountDiscount = 0
        totalAmountDiscount = 0
    End Sub
    Public Sub CountAmountofCharge()
        amountOfCharge = 0
        If typeOfRoom = 1 Then 'single room

            If numberOfGuests > 1 Then
                amountOfCharge = amountOfCharge + (numberOfGuests - 1) * 10 * numberOfDays
            End If
            If checkInBefore = True Then
                amountOfCharge += 30
            End If
            If chekOutAfer = True Then
                amountOfCharge += 44.5
            End If
            If numberOfDays <= 3 Then
                amountOfCharge = amountOfCharge + numberOfDays * 89
            End If
            If numberOfDays > 3 And numberOfDays <= 7 Then
                amountOfCharge = amountOfCharge + 3 * 89
                amountOfCharge = amountOfCharge + (numberOfDays - 3) * 89 * 10 / 100
            End If
            If numberOfDays > 7 Then
                amountOfCharge = amountOfCharge + 3 * 89
                amountOfCharge = amountOfCharge + (numberOfDays - 3) * 89 * 15 / 100
            End If
        End If

        If typeOfRoom = 2 Then 'double room

            If numberOfGuests > 2 Then
                amountOfCharge = amountOfCharge + (numberOfGuests - 2) * 15 * numberOfDays
            End If
            If checkInBefore = True Then
                amountOfCharge += 30
            End If
            If chekOutAfer = True Then
                amountOfCharge += 49.5 ' a half of 99
            End If
            If numberOfDays <= 3 Then
                amountOfCharge = amountOfCharge + numberOfDays * 99
            End If
            If numberOfDays > 3 And numberOfDays <= 7 Then
                amountOfCharge = amountOfCharge + 3 * 99
                amountOfCharge = amountOfCharge + (numberOfDays - 3) * 99 * 10 / 100
            End If
            If numberOfDays > 7 Then
                amountOfCharge = amountOfCharge + 3 * 99
                amountOfCharge = amountOfCharge + (numberOfDays - 3) * 99 * 15 / 100
            End If
        End If

        If typeOfRoom = 3 Then 'double room
            If numberOfGuests > 5 Then
                amountOfCharge = amountOfCharge + (numberOfGuests - 5) * 20 * numberOfDays
            End If
            If checkInBefore = True Then
                amountOfCharge += 30
            End If
            If chekOutAfer = True Then
                amountOfCharge += 64.5 ' a half of 129
            End If
            If numberOfDays <= 3 Then
                amountOfCharge = amountOfCharge + numberOfDays * 129
            End If
            If numberOfDays > 3 And numberOfDays <= 7 Then
                amountOfCharge = amountOfCharge + 3 * 99
                amountOfCharge = amountOfCharge + (numberOfDays - 3) * 129 * 10 / 100
            End If
            If numberOfDays > 7 Then
                amountOfCharge = amountOfCharge + 3 * 99
                amountOfCharge = amountOfCharge + (numberOfDays - 3) * 129 * 15 / 100
            End If
        End If
    End Sub
    Public Sub CountChareForExtraUser()
        If typeOfRoom = 1 Then
            If numberOfGuests > 1 Then
                totalChargeForExGuest = (numberOfGuests - 1) * 10 * numberOfDays
            End If
        End If
        If typeOfRoom = 2 Then
            If numberOfGuests > 2 Then
                totalChargeForExGuest = (numberOfGuests - 2) * 15 * numberOfDays
            End If
        End If
        If typeOfRoom = 3 Then
            If numberOfGuests > 3 Then
                totalChargeForExGuest = (numberOfGuests - 3) * 25 * numberOfDays
            End If
        End If
    End Sub
    Public Sub CountAmountDiscount()
        If typeOfRoom = 1 Then
            If numberOfDays > 3 And numberOfDays <= 7 Then
                totalAmountDiscount = (numberOfDays - 3) * 89 * 10 / 100
            End If
            If numberOfDays > 7 Then
                totalAmountDiscount = (numberOfDays - 3) * 89 * 15 / 100
            End If
        End If
        If typeOfRoom = 2 Then
            If numberOfDays > 3 And numberOfDays <= 7 Then
                totalAmountDiscount = (numberOfDays - 3) * 99 * 10 / 100
            End If
            If numberOfDays > 7 Then
                totalAmountDiscount = (numberOfDays - 3) * 99 * 15 / 100
            End If
        End If
        If typeOfRoom = 3 Then
            If numberOfDays > 3 And numberOfDays <= 7 Then
                totalAmountDiscount = (numberOfDays - 3) * 129 * 10 / 100
            End If
            If numberOfDays > 7 Then
                totalAmountDiscount = (numberOfDays - 3) * 129 * 15 / 100
            End If
        End If
    End Sub

End Class
